<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>login</title>
    <link rel="stylesheet" href="../../style/login/login.css">
    <link rel="short cut" href="../../favicon.ico"/>
    <!-- <link href="css/login.css" rel="stylesheet"> -->
    <script type="text/javascript" src="../../plugins/jQuery/jquery-3.6.0.js"></script>
    <script type="text/javascript" src="../../plugins/vue/vue.js"></script>
    <script type="text/javascript" src="../../plugins/axios/axios.js"></script>
    <script type="text/javascript" src="../../plugins/layer-master/dist/layer.js"></script>
</head>

<body>
<div id="app">
    <form id="form" method="post">
        <h1 id="loginMsg">登 录</h1>
        <label style="color: red">{{error}}</label>
        <p><label for="yisZhanghao">账号:</label>
            <input id="yisZhanghao" name="yisZhanghao" type="text" v-model="yisZhanghao"
                   autocomplete="off">
        </p>

        <p><label for="yisMima">密码:</label>
            <input id="yisMima" name="yisMima"
                   type="password" v-model="yisMima">
        </p>
        <div id="subDiv">
            <input type="button" class="loginButton" value="登录" @click="login">
            <input type="reset" class="button" value="重置">&nbsp;&nbsp;&nbsp;
        </div>
    </form>
</div>


</body>
</html>
<script type="text/javascript">
    new Vue({
        el: '#app',
        data: {
            yisZhanghao: '',
            yisMima: ''
        },
        methods: {
            login(){
                axios({
                    url: 'http://localhost:8899/yis/denglu',
                    method: 'get',
                    params: {
                        yisZhanghao: this.yisZhanghao,
                        yisMima: this.yisMima
                    }
                }).then(resp=> {
                    let result = resp.data
                    if (result.success){
                       localStorage.setItem('yisheng_yisXingming',resp.data)
                       location.href = '../../bi.html'

                        return;
                    }
                    this.error = result.error
                })
            }

        }
    })

</script>